|
|
|
|
|
|
|
What Are the Advantages of Using ActiveX Documents? |
|
|
|
|
|
|
|
|
The primary reason to use ActiveX documents in Visual Basic is to create Internet-enabled applications. Creating ActiveX documents provides a number of advantages over creating Internet applications by other means. Some of these advantages include the following: |
|
|
|
|
|
|
|
|
You do not have to learn another programming language to create the documents. All your Visual Basic expertise can be applied to ActiveX documents. |
|
|
|
|
|
|
|
|
You can design your Internet application by using the Visual Basic design environment. This process is much simpler than the code-and-test method that you have to use with some other languages. |
|
|
|
|
|
|
|
|
You also have access to Visual Basic's rich debugging environment for testing your code and fixing any problems that arise. |
|
|
|
|
|
|
|
|
By using the Hyperlink object, you can easily navigate to other pages from the browser. These pages can be other ActiveX documents or any Web address. |
|
|
|
|
|
|
|
|
So, Visual Basic makes creating an ActiveX document easy, but why would you want to create one in the first place? Why not just create a standard application? The answer, in a word, is "Internet." ActiveX frees you of the complications involved with the older means of distributing an application. If your program is a standard EXE, then you must send installation diskettes to all the users. ActiveX documents, on the other hand, can be set up on a Web server so that they are downloaded automatically when a user opens the Web page. Codes embedded in the Web page tell Internet Explorer to download a cabinet (CAB) file containing your application and all necessary components. This Web-based approach makes it simpler to maintain your code and to keep everyone running the same version. |
|
|
|
|
|
|
|
|
Of course, using ActiveX documents over the Internet does have some disadvantages. The main disadvantages are as follows: |
|
|
|
|
|
|
|
|
At the time of this writing, only Microsoft's browser, Internet Explorer, supports ActiveX. Therefore, if your audience is the whole Internet (versus a corporate intranet, for example), you may want to investigate a server-side approach, such as using Active Server Pages. |
|
|
|
|
|
|
|
|
Even though Internet Explorer handles downloading your application, it still has to be "installed" on the client PCwith all the proper support files. Every time you create a new version of your ActiveX document, the users need to update a local copy, which may be time consuming on a slow Internet connection. |
|
|
|
|
|
|
|
|
Creating Your First ActiveX Document |
|
|
|
|
|
|
|
|
Creating an ActiveX document is similar to creating standard applications in Visual Basic. In this chapter, you will re-create the loan payment calculator example from Chapter 2, "Creating Your First Program," but this time as an ActiveX document. To create a document, follow this basic sequence of events: |
|
|
|
|
|